package com.nicolas.pattern.factory;

/**
 * 工厂方法模式测试
 * @author nicolas 2017-02-11
 *
 */
public class FactoryMain {
	
    public static void main(String[] args) {  
        SendFactory factory = new SendFactory();  
        
        //普通工厂调用
        Sender sender = factory.produce("mail");  
        System.out.println("普通工厂调用");
        sender.Send();  
        
        //多个工厂调用
        Sender senderMail = factory.produceMail();
        Sender senderSms = factory.produceSms();
        System.out.println("多个工厂调用");
        senderMail.Send();
        senderSms.Send();
        
        //静态工厂调用
        Sender senderMailStatic = SendFactory.produceStaticMail();
        Sender senderSmsStatic = SendFactory.produceStaticSms();
        System.out.println("静态工厂调用");
        senderMailStatic.Send();
        senderSmsStatic.Send();
        		
    }  
}
